const fs = require('fs')
const path = require('path')


const filePath = path.join(__dirname, './info.json')
// console.log(filePath);
const res = fs.readFileSync(filePath, 'utf-8')

// json文件转数组
const arr = JSON.parse(res)
// 获取随机值
const ran = Math.floor(Math.random() * (arr.length + 1 - 0)) + 0;

//获取count的值转为字符串

console.log(arr[ran]);
console.log(arr[ran].count = arr[ran].count + 1);
// console.log(arr);
const newarr = JSON.stringify(arr)
console.log(newarr);
fs.writeFileSync('./info.json', newarr)


